// Josh made this

#include "Tiger.h"
#include "Hunter.h"
#include "WindowManager.h"
#include "SFML\System.hpp"

sf::Texture *TigerObject::tigerTex;

void TigerObject::Render()
{
	WindowMan::GetWindow()->draw(tigerSprite);
}

void TigerObject::Update()
{
	static Clock running;
	float t = running.getElapsedTime().asSeconds();

	float tigerSpeed = -0.3f;

	tigerSprite.setScale(2.f, 2.f);
	Object::Animation(tigerSprite, 0, 0, 56, 35);

	Object::r.top = 0.0f;
	Object::r.left = 0.0f;
	Object::r.height = 0.0f;
	Object::r.width = 0.0f;

	if (backgroundSpeed == 0) tigerSpeed = 0;

	if (t > 0.2f && backgroundSpeed != 0)
	{
		Object::Animation(tigerSprite, 56, 0, 56, 35);

		if (t > 0.4)
		{
			Object::Animation(tigerSprite, 112, 0, 56, 35);

			if (t > 0.6f) running.restart();
		}
	}

	if (caughtTiger)
	{
		tigerSprite.setRotation(180.f);
	}

	if (isDead)
	{
		tigerSpeed = 4.0f;

		Object::Animation(tigerSprite, 56, 0, 56, 35);

		if (t > 0.4)
		{
			Object::Animation(tigerSprite, 112, 0, 56, 35);

			if (t > 0.6f) running.restart();
		}
	}

	tigerSprite.move(tigerSpeed, 0);
}